package cn.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
public class AnnotationController {
    @RequestMapping("firstController")
    public String handleRequest(HttpServletRequest request, HttpServletResponse response, Model model) {
        model.addAttribute("msg", "这是我的第一个springmvc程序,我用annotation方式入门了");
        return "/WEB-INF/pages/annotation.jsp"; //后面会配置视图解析器,然后可省略前缀和后缀
    }
    /**
     * 测试访问 http://localhost:8080/annotation/firstController
     * 注：中间的"annotation"是发布到tomcat时的项目根目录
     */
}
